ruby: link ext/digest/* to openssl only when needed, fix rmd160 name
authorLuiz Angelo Daros de Luca <[email protected]>
Sat, 4 Oct 2014 20:51:56 +0000 (17:51 -0300)
committerLuiz Angelo Daros de Luca <[email protected]>
Tue, 7 Oct 2014 17:14:53 +0000 (14:14 -0300)
ext/digest/rmd160 was referencing a function that never existed in openssl.
The name was simply mistyped. Now it can use openssl.

openssl was always linked to ext/digest when library is avaiable,
even when it was disable by configure option and not used by code.

upstream refs: https://bugs.ruby-lang.org/issues/10252
upstream refs: https://bugs.ruby-lang.org/issues/10324

Signed-off-by: Luiz Angelo Daros de Luca <[email protected]>
lang/ruby/Makefile
lang/ruby/patches/003-digest_rmd160_wrong_name_fix.patch [new file with mode: 0644]
lang/ruby/patches/004-digest_dont-link-ssl-if-not-needed.patch [new file with mode: 0644]

index ce622084b6cd08573a5bbce618c0468759c4b131..cb52d9b88427fe2dc5f9c87d67a2390e3e14e434 100644 (file)
@@ -16,7 +16,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ruby
 PKG_VERSION:=2.1.2
-PKG_RELEASE:=6
+PKG_RELEASE:=7
 
 PKG_LIBVER:=2.1
 
diff --git a/lang/ruby/patches/003-digest_rmd160_wrong_name_fix.patch b/lang/ruby/patches/003-digest_rmd160_wrong_name_fix.patch
new file mode 100644 (file)
index 0000000..2dc49f6
--- /dev/null
@@ -0,0 +1,12 @@
+diff -r -u ruby-2.1.2.old/ext/digest/rmd160/extconf.rb ruby-2.1.2/ext/digest/rmd160/extconf.rb
+--- ruby-2.1.2.old/ext/digest/rmd160/extconf.rb        2012-11-26 22:58:52.000000000 -0200
++++ ruby-2.1.2/ext/digest/rmd160/extconf.rb    2014-09-17 14:20:57.537367488 -0300
+@@ -14,7 +14,7 @@
+ require File.expand_path('../../../openssl/deprecation', __FILE__)
+ if !with_config("bundled-rmd160") &&
+-    have_library("crypto") && OpenSSL.check_func("RMD160_Transform", "openssl/ripemd.h")
++    have_library("crypto") && OpenSSL.check_func("RIPEMD160_Transform", "openssl/ripemd.h")
+   $objs << "rmd160ossl.#{$OBJEXT}"
+ else
+   $objs << "rmd160.#{$OBJEXT}"
diff --git a/lang/ruby/patches/004-digest_dont-link-ssl-if-not-needed.patch b/lang/ruby/patches/004-digest_dont-link-ssl-if-not-needed.patch
new file mode 100644 (file)
index 0000000..792f76c
--- /dev/null
@@ -0,0 +1,117 @@
+--- ruby-2.1.2/ext/digest/md5/extconf.rb       2012-11-26 22:58:52.000000000 -0200
++++ ruby-2.1.2/ext/digest/md5/extconf.rb       2014-09-16 19:25:21.120457409 -0300
+@@ -9,14 +9,21 @@
+ $objs = [ "md5init.#{$OBJEXT}" ]
+-dir_config("openssl")
+-pkg_config("openssl")
+-require File.expand_path('../../../openssl/deprecation', __FILE__)
++if !with_config("bundled-md5")
++  dir_config("openssl")
++  pkg_config("openssl")
++  require File.expand_path('../../../openssl/deprecation', __FILE__)
++  if have_library("crypto") && OpenSSL.check_func("MD5_Transform", "openssl/md5.h")
++    $use_bundled=false
++  else
++    $use_bundled=true
++  end
++else
++  $use_bundled=true
++end
+-if !with_config("bundled-md5") &&
+-    have_library("crypto") && OpenSSL.check_func("MD5_Transform", "openssl/md5.h")
++if !$use_bundled
+   $objs << "md5ossl.#{$OBJEXT}"
+-
+ else
+   $objs << "md5.#{$OBJEXT}"
+ end
+--- ruby-2.1.2/ext/digest/rmd160/extconf.rb    2012-11-26 22:58:52.000000000 -0200
++++ ruby-2.1.2/ext/digest/rmd160/extconf.rb    2014-09-16 19:29:11.425628541 -0300
+@@ -9,12 +9,20 @@
+ $objs = [ "rmd160init.#{$OBJEXT}" ]
+-dir_config("openssl")
+-pkg_config("openssl")
+-require File.expand_path('../../../openssl/deprecation', __FILE__)
++if !with_config("bundled-rmd160")
++  dir_config("openssl")
++  pkg_config("openssl")
++  require File.expand_path('../../../openssl/deprecation', __FILE__)
++  if have_library("crypto") && OpenSSL.check_func("RIPEMD160_Transform", "openssl/ripemd.h")
++    $use_bundled=false
++  else
++    $use_bundled=true
++  end
++else
++  $use_bundled=true
++end
+-if !with_config("bundled-rmd160") &&
+-    have_library("crypto") && OpenSSL.check_func("RIPEMD160_Transform", "openssl/ripemd.h")
++if !$use_bundled
+   $objs << "rmd160ossl.#{$OBJEXT}"
+ else
+   $objs << "rmd160.#{$OBJEXT}"
+--- ruby-2.1.2/ext/digest/sha1/extconf.rb      2012-11-26 22:58:52.000000000 -0200
++++ ruby-2.1.2/ext/digest/sha1/extconf.rb      2014-09-16 19:30:09.359168494 -0300
+@@ -9,12 +9,20 @@
+ $objs = [ "sha1init.#{$OBJEXT}" ]
+-dir_config("openssl")
+-pkg_config("openssl")
+-require File.expand_path('../../../openssl/deprecation', __FILE__)
++if !with_config("bundled-sha1")
++  dir_config("openssl")
++  pkg_config("openssl")
++  require File.expand_path('../../../openssl/deprecation', __FILE__)
++  if have_library("crypto") && OpenSSL.check_func("SHA1_Transform", "openssl/sha.h")
++    $use_bundled=false
++  else
++    $use_bundled=true
++  end
++else
++  $use_bundled=true
++end
+-if !with_config("bundled-sha1") &&
+-    have_library("crypto") && OpenSSL.check_func("SHA1_Transform", "openssl/sha.h")
++if !$use_bundled
+   $objs << "sha1ossl.#{$OBJEXT}"
+ else
+   $objs << "sha1.#{$OBJEXT}"
+--- ruby-2.1.2/ext/digest/sha2/extconf.rb      2012-11-26 22:58:52.000000000 -0200
++++ ruby-2.1.2/ext/digest/sha2/extconf.rb      2014-09-16 19:31:31.833513570 -0300
+@@ -9,14 +9,22 @@
+ $objs = [ "sha2init.#{$OBJEXT}" ]
+-dir_config("openssl")
+-pkg_config("openssl")
+-require File.expand_path('../../../openssl/deprecation', __FILE__)
+-
+-if !with_config("bundled-sha2") &&
+-    have_library("crypto") &&
++if !with_config("bundled-sha2")
++  dir_config("openssl")
++  pkg_config("openssl")
++  require File.expand_path('../../../openssl/deprecation', __FILE__)
++  if have_library("crypto") &&
+     %w[SHA256 SHA512].all? {|d| OpenSSL.check_func("#{d}_Transform", "openssl/sha.h")} &&
+     %w[SHA256 SHA512].all? {|d| have_type("#{d}_CTX", "openssl/sha.h")}
++    $use_bundled=false
++  else
++    $use_bundled=true
++  end
++else
++  $use_bundled=true
++end
++
++if !$use_bundled
+   $objs << "sha2ossl.#{$OBJEXT}"
+   $defs << "-DSHA2_USE_OPENSSL"
+ else